#include <stdio.h>

float lst[100];
int N;

int mindex = 0, maxdex = 0;
float min, max;
float sum;
float avg;
float temp;
float maxtemp = 0;

void main() {
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%f", &lst[i]);
    }
    min = lst[0];
    max = lst[0];

    for (int i = 0; i < N; i++) {
        if (lst[i] < min) {
            min = lst[i];
            mindex = i;
        }
        if (lst[i] > max) {
            max = lst[i];
            maxdex = i;
        }
    }

    sum = 0.0;
    
    for (int i = 0; i < N; i++) {
        if (i != mindex && i != maxdex) {
            sum += lst[i];
            
        }
    }
    avg = sum / (N-2);

    maxtemp = 0;
    for (int i = 0; i < N; i++) {
        if (i != mindex && i != maxdex) {
            temp = lst[i] - avg;
            if (temp < 0) {
                temp = -temp;
            }
            if (temp > maxtemp) {
                maxtemp = temp;
            }
        }
    }
    printf("%.2f %.2f", avg, maxtemp);
}